Week 2 Practical Reverse Engineering: Scrabble & Ciphers
Section 1: Scrabble Engine Deconstruction
The execution binary prompts two interactive users for distinct vocabulary string inputs. It dynamically calculates the absolute cumulative score of each word utilizing an immutable point matrix, subsequently printing the definitive winner to standard output.
===================================================================================
SCRABBLE REVERSE ENGINEERING PIPELINE
===================================================================================
[ Input String (Word) ] ββ> [ Loop Character by Character (strlen) ]
β
βΌ
[ isalpha() ? Convert to Uppercase (toupper) ]
β
βΌ
[ Index Calculation: char - 'A' (0 to 25) ]
β
βΌ
[ Lookup in POINTS[] Matrix ] ββ> [ Accumulate Total Score ]
===================================================================================
- The POINTS Lookup Matrix: Character weightings are statically allocated within a 26-element integer matrix
int POINTS[] = {1, 3, 3, 2, ...}. - Forensic Indexing Mechanism: To extract the integer weight of character C, the CPU executes the baseline subtraction
67 - 65 ('A') = 2.
Section 2: Readability Engine Deconstruction
Rather than instantiating three isolated loops to evaluate letter, word, and sentence totals, we construct an optimized, unified single-pass scanner that inspects the character stream in real-time.
===================================================================================
READABILITY PARSER LOGIC TREE
===================================================================================
[ Character Scanner (s[i]) ]
βββ isalpha(s[i]) ββ> letters++
βββ isspace(s[i]) ββ> words++ (Initialize words at 1)
βββ s[i] == '.' || s[i] == '!' || s[i] == '?' ββ> sentences++
===================================================================================
- Strict Coleman-Liau Mathematical Application: Computing exact letter/sentence ratios and rounding the final float to output
Grade X.
Section 3: Cryptographic Cipher Engines (Caesar & Substitution)
Forensic deconstruction of the Caesar and Substitution problem sets to validate CLI parameters and enforce strict cryptographic transformations.
- CLI Argument Guardrails: The main entry point must enforce
argc == 2and validate the key format (numeric for Caesar, 26 unique alpha characters for Substitution). - Case Preservation Protocol: During mathematical rotation, uppercase and lowercase characters maintain their exact casing, while non-alphabetical punctuation bypasses transformation entirely.